package cn.restcloud.example.controller;

import cn.restcloud.framework.client.RestClient;
import cn.restcloud.framework.core.annotation.bean.BeanConfig;
import cn.restcloud.framework.core.annotation.bean.BeanType;
import cn.restcloud.framework.core.annotation.rest.MethodType;
import cn.restcloud.framework.core.annotation.rest.RestConfig;
import cn.restcloud.framework.core.util.DocumentUtil;
import cn.restcloud.framework.core.util.LogUtil;
import cn.restcloud.framework.view.base.DocAndView;
import cn.restcloud.framework.view.util.ViewUtil;
import org.bson.Document;

/**
 * 给系统API的调用日记增加自定义的业务标签
 * @author restcloud
 */

@BeanConfig(appId = "example",beanId = "BusinessLogTagRest",beanName = "本地缓存使用示例",beanType = BeanType.CONTROLLER,autowired = true,singleton = true,hotMode = true)
@RestConfig(url = "/rest/example/log")
public class BusinessLogTagRest {
	
	@RestConfig(configName = "添加Tags到API调用日记中",method = MethodType.GET,url = "/addtag")
	public DocAndView addLogTag() throws Exception{
		//可以在系统出错或者有必要的时候追加业务tag到日记中
		LogUtil.addLogTags("100001"); //向API日记中追加一个订单号的tag
		LogUtil.addLogTags("笔记本电脑"); //向API日记中追加一个订单号的产品名称
		return ViewUtil.getSuccessView("添加成功,可以监控中的日记搜索中进行此标签的搜索");

	}
	
}
